package com.peas.platform.framework.mybatisplus.po;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;

import java.io.Serializable;
import java.util.Date;

@Data
public abstract class BasePo implements Serializable {

    //主键ID
    @TableId(value = "`id`", type = IdType.ASSIGN_ID)
    private Long id;

    //删除标识(0未删除、1已删除)
    @TableField(value = "`deleted`", fill = FieldFill.INSERT, jdbcType = JdbcType.INTEGER)
    private Integer deleted;

    //创建人用户ID
    @TableField(value = "`create_by`", fill = FieldFill.INSERT, jdbcType = JdbcType.BIGINT)
    private Long createBy;

    //创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT, jdbcType = JdbcType.TIMESTAMP)
    private Date createTime;

    //最后修改人用户ID
    @TableField(value = "`update_by`", fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.BIGINT)
    private Long updateBy;

    //最后修改时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.TIMESTAMP)
    private Date updateTime;

    //数据版本
    @Version
    @TableField(value = "`version`", fill = FieldFill.INSERT)
    private Integer version;

}
